package com.ybbase.framework.service.flow.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ybbase.framework.model.po.flow.InstanceRecord;
import com.ybbase.framework.mapper.flow.InstanceRecordMapper;
import com.ybbase.framework.service.flow.InstanceRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 流程实例记录表 服务实现类
 * </p>
 *
 * @author cg
 * @since 2019-12-04
 */
@Service
public class InstanceRecordServiceImpl extends ServiceImpl<InstanceRecordMapper, InstanceRecord> implements InstanceRecordService {
    @Autowired
    InstanceRecordMapper instanceRecordMapper;

    @Override
    public InstanceRecord getInstanceRecordByObj(String businessId,String businessCode){
        QueryWrapper<InstanceRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(InstanceRecord::getBusinessId, businessId);
        queryWrapper.lambda().eq(InstanceRecord::getIsFinish, 0);
        queryWrapper.lambda().eq(InstanceRecord::getIsSuspended, 0);
        queryWrapper.lambda().eq(InstanceRecord::getBusinessCode, businessCode);
        return instanceRecordMapper.selectOne(queryWrapper);
    }

}
